//
//  QDRecordBusTableCell.swift
//  QDMetroClient
//
//  Created by YueWen on 2019/3/1.
//  Copyright © 2019 YueWen. All rights reserved.
//

import UIKit

/// 公交乘车记录cell
final class QDRecordBusTableCell: NWTableViewCell {
    
    /// 放底部阴影块的视图
    private let backgroundImageView = UIImageView()
    /// 显示公交编号
    let titleLabel = UILabel()
    /// 显示时间的标签
    let timeLabel = UILabel()
    /// 价格的标签
    let priceLabel = UILabel()
    
    override func buildView() {
        super.buildView()
        
        contentView.backgroundColor = RecordBackgroundColor
        
        backgroundImageView.image = "mr_background".namedImage?.resizableImage(withCapInsets: UIEdgeInsets(top: 20, left: 10, bottom: 20, right: 10))
        
        titleLabel.text = "公交-001892"
        titleLabel.font = Font.regular.font(size: 14)
        titleLabel.textColor = #colorLiteral(red: 0.3960784314, green: 0.4, blue: 0.3960784314, alpha: 1)
        
        timeLabel.text = "12-02 14:22 "
        timeLabel.font = Font.light.font(size: 14)
        timeLabel.textColor = QDColors.gray2
        
        priceLabel.text = "0.88元"
        priceLabel.font = Font.regular.font(size: 14)
        priceLabel.textColor = QDColors.black
        
        contentView.addSubview(backgroundImageView)
        contentView.addSubview(titleLabel)
        contentView.addSubview(timeLabel)
        contentView.addSubview(priceLabel)
        
        backgroundImageView.snp.makeConstraints { (make) in
            make.top.bottom.equalToSuperview()
            make.left.equalToSuperview().offset(13)
            make.right.equalToSuperview().inset(13)
        }
        
        titleLabel.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(19)
            make.left.equalToSuperview().offset(40)
            make.height.equalTo(20)
        }
        
        timeLabel.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(40)
            make.top.equalTo(titleLabel.snp.bottom).offset(4)
            make.height.equalTo(20)
        }
        
        priceLabel.snp.makeConstraints { (make) in
            make.right.equalToSuperview().inset(40)
            make.height.equalTo(20)
            make.top.equalToSuperview().offset(19)
        }
    }
}


